<template>
  <div class="main-header">
    <div class="header-left" @click="toHomePage" v-cloak>
      <img class="big-data" src="@/assets/big-data.png" alt="">
      {{sysTitle}}
    </div>
    <el-dropdown class="header-right">
      <div class="el-dropdown-link">
        <span>你好，<span style="color:#FFFC6F">{{username}}</span></span>
      </div>
      <div class="user-logo">
        <i @click="goUserCenter" class="wow-icon-user"></i>
      </div>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item><span @click="goUserCenter"><i class="wow-icon-user"></i>个人中心</span></el-dropdown-item>
        <el-dropdown-item><span @click="quit"><i class="wow-icon-outing"></i>退出登录</span></el-dropdown-item>
      </el-dropdown-menu>
      </el-dropdown>
        <el-dialog
          :visible.sync="centerDialogVisible"
          width="30%"
          center>
          <i class="el-icon-warning"></i>
          <span>您确认要退出登录吗？</span>
          <span slot="footer" class="dialog-footer">
            <el-button class="yesbtn">确定</el-button>
            <el-button class="nobtn" @click="noCallBack">取消</el-button>
          </span>
        </el-dialog>
  </div>
</template>
<script>
export default {
  name: 'Header',
  data () {
    return {
      user: '',
      username: '超级管理员',
      sysTitle: '科技管理系统',
      centerDialogVisible: false
    }
  },
  methods: {
    toIndex () {

    },
    toHomePage () {

    },
    goUserCenter () {

    },
    logOut () {

    },
    quit () {

    },
    noCallBack () {
      this.centerDialogVisible = false
    }
  },
  mounted () {

  }
}
</script>
<style lang="scss">
.main-header {
  width: 100%;
  position: relative;
  z-index: 3;
  display: flex;
  margin: 0 auto;
  .header-left {
    width: 90%;
    padding-left: 12px;
    display: flex;
    align-items: center;
    font-size: 18px;
    color: #FFFFFF;
    letter-spacing: 0.9px;
    cursor: pointer;
    .big-data {
      margin-right: 20px;
    }
  }
  .header-right {
    width: 160px;
    cursor: pointer;
    transition: 0.2s;
    color: #fff;
    .user-logo{
      width: 28px;
      height: 28px;
      line-height: 28px;
      text-align: center;
      border-radius: 50%;
      background-color: #007872;
      margin-left: 10px;
      .wow-icon-user{
        color: #06AEA6;
      }
    }
    .user-welcome {
      width: 32px;
      height: 32px;
      border-radius: 16px;
      background: #007872;
      display: flex;
      align-items: center;
      justify-content: center;
      user-select: none;
    }
    .logOut {
      position: absolute;
      z-index: -1;
      bottom: 0;
      transform: translateY(100%);
      width: 120px;
      right: 18px;
      height: 35px;
      transition: 0.2s;
      background: #fff;
      color: #666666;
      box-shadow: 0 2px 8px rgba(0,0,0,.1);
      filter: drop-shadow(0 2px 8px rgba(0,0,0,.1));
      border-radius: 5px;
      font-size: 14px;
      user-select: none;
      display: none;
      .quit {
        width: 14px;
        margin-left: 8px;
        margin-right: 6px;
      }
      &:hover {
        background-color: #ecf5ff;
      }
    }
    &:hover {
      // background-color: #0c9f94;
      .logOut {
        display: flex;
        align-items: center;
        justify-content: flex-start;
      }
    }
  }
  // 下拉框
  .el-dropdown-menu__item:focus, .el-dropdown-menu__item:not(.is-disabled):hover {
      background-color: #eee;
      color: #06AEA6;
  }
  .el-popper[x-placement^=bottom] {
    margin-top: 0;
  }
  .el-dropdown-menu{
    width: 110px;
    margin: 0;
    padding: 0;
    border-radius: 0;
    .el-dropdown-menu__item{
      font-size: 12px;
      text-align: center;
      .wow-icon-user,.wow-icon-outing{
        margin-right: 6px;
      }
    }
  }
}
</style>
